home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / diskmags / shoah_s_iss1.lha / source / Vector.s < prev   
Encoding:
Text File  |  1991-06-13  |  16.7 KB  |  635 lines

  1. ;      _______  ___                    ___        _______
  2. ;     /°-     \/. /    _____   ____   / ./       /°-     \
  3. ;     \   \___//  \___/°    \_/°   \_/   \___    \   \___/
  4. ;    _/\__    \      ~\_  /\  \  /\ ~\      °\_ _/\__    \
  5. ;    \\       /   /\   /  \/. /  \/   \ //\   / \\       /
  6. ;     \______/\__/  \_/\_____/\____/\_/_/  \_/ o \______/ Issue 1
  7.  
  8. ***********************************************************
  9. * © 1992 Epsilon
  10. *
  11. * This is just some crummy filled convex vectors.  This source is very
  12. * slow, but it works.
  13. *
  14. * I'd like to thank Tip, of SpreadPoint, for writing and spreading what
  15. * is quite possibly the fastest line drawing routine for the Amiga.  I
  16. * modified it just a little bit so that it would work in multiple colors.
  17. * The original version should also be found in this archive, if it isn't
  18. * then contact me.
  19. *
  20. * I can be reached at:
  21. *            Epsilon
  22. *            P.O.B. 1914
  23. *            Beaverton, OR  97075-1914
  24. *            U.S.A.
  25. * Or, you can e-mail me at:
  26. *            idr@rigel.cs.pdx.edu
  27. * Enjoy!
  28. ***********************************************************
  29.  
  30. ;*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*
  31. ;*+*+*+                                  *+*+*+
  32. ;*+*+*+    I re-wrote the startup code for this to make it A1200      *+*+*+
  33. ;*+*+*+    compatable, and generally altered things to make it run      *+*+*+
  34. ;*+*+*+    a little bit quicker, oh and I made the colour scheme a      *+*+*+
  35. ;*+*+*+    bit nicer ( I think so anyway ). If you use this routine  *+*+*+
  36. ;*+*+*+    then please credit Epsilon, NOT me, I didn't do any of    *+*+*+
  37. ;*+*+*+    the hard work !            Squize 16/12/94          *+*+*+
  38. ;*+*+*+                                  *+*+*+
  39. ;*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*
  40.  
  41.     opt c-                ;Always set this !
  42.  
  43.     Section    Vector,Code        ;Always put the code in public mem,
  44.                     ;so people with Fast Ram get the
  45.                     ;benefit
  46.  
  47. ;*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*
  48.  
  49.     include    SHOAH.s:SHOAH_Libs/Macros.lib
  50.                     ;I've made some nice macros to
  51.                     ;make life that little bit easier
  52.  
  53. ;*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*
  54.  
  55. Start:
  56.     bsr.s    TakeSystem        ;Kill the OS
  57.     tst    d0            ;Did we have an error ?
  58.     bne.s    Error            ;Yes, so quit
  59.  
  60.     bsr    Init            ;Run our little example
  61.  
  62.     bsr    RestoreSystem        ;Finished, so restore the OS
  63.  
  64.     moveq.l    #0,d0            ;Keep Mr.CLI happy
  65. Error:
  66.     rts
  67.  
  68. ;*+*+*+*+*+*+*+*+*+*+*+- Library Routines -+*+*+*+*+*+*+*+*+*+*+*+*+*+*+
  69.     
  70.     include    SHOAH.s:SHOAH_Libs/Startup.lib
  71.  
  72. ;*+*+*+*+*+*+*+*+*+*+*+- Start up Routines -+*+*+*+*+*+*+*+*+*+*+*+*+*+*
  73. Init:
  74.     lea    $dff000,a5            ;Point to the hardware
  75.     lea    labels,a4            ;Speeds things up a tiny bit
  76.  
  77.     Copper_Set    Copperlist        ;This is my macro for turning
  78.                         ;on the copperlist
  79.     move.l    #Cube,CurrentObject-labels(a4)
  80.     move    #600,Scale-labels(a4)        ;Alter this for a different
  81.                         ;sized cube
  82.     move    #5,XInc-labels(a4)        ;Alter these to make it spin
  83.     move    #1,YInc-labels(a4)        ;differently
  84.     move    #2,ZInc-labels(a4)
  85.  
  86.     move    #%1000001111000000,$96(a5)    ;DMA:Blit/Bitpl/Copper
  87.  
  88.     bsr    Main                ;Now run the main loop
  89.  
  90.     rts
  91.  
  92. ;*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*
  93. ;*+*+*+*+*+*+*+*+*+*+*+- The Main Loop -+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*
  94. ;*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*
  95. MAIN:
  96.     VBlank                ;Wait for...
  97.  
  98. ;*+*+*+    Vector routine
  99.  
  100.     bsr    CLS            ;Clear the screen (With the blitter)
  101.     bsr    Rotate            ;Do the magic xyz thing
  102.     bsr    FlipBmaps        ;Double buffering
  103.  
  104. ;*+*+*+    Check for quit
  105.  
  106.     Mouse_button    Main        ;Another macro, if the left mouse
  107.                     ;button is not pressed then it'll
  108.                     ;loop to main
  109.     rts                ;LMB pressed, so return to "Init"
  110.  
  111. ;*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*
  112. ;*+*+*+*+*+*+*+*+*+*+*+- Subroutines -+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*
  113. ;*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*
  114.  
  115. ;*+*+*+*+*+*+*+*+*+*+*+- Double buffering -+*+*+*+*+*+*+*+*+*+*+*+*+*+*+
  116. FlipBmaps:
  117.     move.l    ActiveBmap-labels(a4),d0
  118.     move.l    VisualBmap-labels(a4),ActiveBmap-labels(a4)
  119.     move.l    d0,VisualBmap-labels(a4)
  120.  
  121. Screen_Pointers:
  122.     lea    BmapPtrs+2,a0
  123.     move.l    VisualBmap-labels(a4),d0
  124.     move.l    #8000,d7
  125.  
  126.     move.l    d0,d1
  127.     move    d1,4(a0)
  128.     swap    d1
  129.     move    d1,(a0)
  130.     add.l    d7,d0
  131.     move.l    d0,d1
  132.     move    d1,12(a0)
  133.     swap    d1
  134.     move    d1,8(a0)
  135.     add.l    d7,d0
  136.     move    d0,20(a0)
  137.     swap    d0
  138.     move    d0,16(a0)
  139.     rts
  140.  
  141. ;*+*+*+*+*+*+*+*+*+*+*+- CLS -+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*
  142. CLS:
  143.     move.l    ActiveBmap,a0            ;Point to the work screen
  144.     addq.l    #6,a0                ;and clear it using nice
  145.     Blitter_Wait                ;Mr.Blitter...
  146.     move    #12,$66(a5)
  147.     move.l    #$01000000,$40(a5)
  148.     Blitter_D    a0
  149.     Blit_Size    #(600*64)+14
  150.     rts
  151.  
  152. ;*+*+*+*+*+*+*+*+*+*+*+- Rotate the points -+*+*+*+*+*+*+*+*+*+*+*+*+*+*
  153. Rotate:
  154.     lea    SineData-labels(a4),a2
  155.     lea    CosineData-labels(a4),a3
  156.     moveq    #0,d5
  157.     move    XAngle-labels(a4),d5
  158.     add.l    d5,d5                ;d5 * 2 (byte offset)
  159.     move    (a2,d5),SinX-labels(a4)        ;d3 = sin(xa)
  160.     move    (a3,d5),CosX-labels(a4)        ;d4 = cos(xa)
  161.  
  162.     move    YAngle-labels(a4),d5
  163.     add.l    d5,d5                ;d5 * 2 (byte offset)
  164.     move    (a2,d5),SinY-labels(a4)        ;d3 = sin(ya)
  165.     move    (a3,d5),CosY-labels(a4)        ;d4 = cos(ya)
  166.  
  167.     move    ZAngle-labels(a4),d5
  168.     add.l    d5,d5                ;d5 * 2 (byte offset)
  169.     move    (a2,d5),SinZ-labels(a4)        ;d3 = sin(za)
  170.     move    (a3,d5),CosZ-labels(a4)        ;d4 = cos(za)
  171.     
  172.     move.l    CurrentObject-labels(a4),a0
  173.     lea    OutputCoords-labels(a4),a1
  174.  
  175.     move    (a0)+,d7            ;d7 = num of coords
  176.     subq    #1,d7
  177.         
  178. CalcLoop:
  179.     movem    (a0)+,d0-d2            ;x,y,z coord
  180.         
  181. ;X rotation
  182.     movem.l    d1/d2,-(sp)            ;save x,y,z
  183.     muls    CosX-labels(a4),d1        ;d1 = y * cos(xa)
  184.     muls    SinX-labels(a4),d2        ;d2 = z * sin(xa)
  185.     add.l    d2,d1                ;d1 = (y*cos(xa))+(z*sin(xa))
  186.     move.l    d1,d5                ;d5 = temporary y
  187.     movem.l    (sp)+,d1/d2
  188.     muls    CosX-labels(a4),d2        ;d2 = z * cos(xa)
  189.     muls    SinX-labels(a4),d1        ;d1 = y * sin(xa)
  190.     sub.l    d1,d2                ;d2 = (z*cos(xa))-(y*sin(xa))
  191.     move.l    d5,d1
  192.  
  193.     lsr.l    #8,d1
  194.     lsr.l    #8,d2
  195.  
  196. ;Y rotation
  197.     movem.l    d0/d2,-(sp)            ;save x,y,z
  198.     muls    CosY-labels(a4),d0        ;d0 = x * cos(ya)
  199.     muls    SinY-labels(a4),d2        ;d2 = z * sin(ya)
  200.     sub.l    d2,d0                ;d0 = (x*cos(ya))-(z*sin(ya))
  201.     move.l    d0,d5                ;d5 = temporary x
  202.     movem.l    (sp)+,d0/d2
  203.     muls    CosY-labels(a4),d2        ;d2 = z * cos(ya)
  204.     muls    SinY-labels(a4),d0        ;d0 = x * sin(ya)
  205.     add.l    d0,d2                ;d2 = (z*cos(ya))+(y*sin(ya))
  206.     move.l    d5,d0
  207.  
  208.     lsr.l    #8,d0
  209.     lsr.l    #8,d2    
  210.  
  211. ;Z rotation
  212.     movem.l    d0/d1,-(sp)            ;save x,y,z
  213.     muls    CosZ-labels(a4),d0        ;d0 = x * cos(za)
  214.     muls    SinZ-labels(a4),d1        ;d1 = y * sin(za)
  215.     sub.l    d1,d0                ;d0 = (x*cos(za))-(y*sin(za))
  216.     move.l    d0,d5                ;d5 = temporary x
  217.     movem.l    (sp)+,d0/d1
  218.     muls    SinZ-labels(a4),d0        ;d0 = x * sin(za)
  219.     muls    CosZ-labels(a4),d1        ;d1 = y * cos(za)
  220.     add.l    d0,d1                ;d1 = (y*cos(za))+(x*sin(za))
  221.     move.l    d5,d0
  222.  
  223.     add    Scale-labels(a4),d2        
  224.     divs    d2,d0
  225.     divs    d2,d1
  226.  
  227.     add    #160,d0
  228.     add    #100,d1
  229.  
  230.     move    d0,(a1)+            ;Store output coordinates
  231.     move    d1,(a1)+
  232.     dbra    d7,CalcLoop
  233.  
  234.     move    XInc-labels(a4),d0
  235.     add    d0,XAngle-labels(a4)
  236.     cmp    #360,XAngle-labels(a4)
  237.     blt.s    NoXAngleReset
  238.     clr    XAngle-labels(a4)
  239.  
  240. NoXAngleReset:    
  241.     move    YInc-labels(a4),d0
  242.     add    d0,YAngle-labels(a4)
  243.     cmp    #360,YAngle-labels(a4)
  244.     blt.s    NoYAngleReset
  245.     clr    YAngle-labels(a4)
  246. NoYAngleReset:    
  247.     move    ZInc-labels(a4),d0
  248.     add    d0,ZAngle-labels(a4)
  249.     cmp    #360,ZAngle-labels(a4)
  250.     blt.s    NoZAngleReset
  251.     clr    ZAngle-labels(a4)
  252. NoZAngleReset:
  253.  
  254. ;*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*
  255. DrawPoly:
  256.     moveq.l    #0,d0
  257.     moveq.l    #0,d1
  258.     moveq.l    #0,d2
  259.     moveq.l    #0,d3
  260.     moveq.l    #0,d5    
  261.  
  262.     lea    OutputCoords-labels(a4),a1
  263.     move    (a0)+,d7            ;d7 = number of surfaces
  264.     move    d7,num_faces-labels(a4)
  265.         
  266.     bsr    DL_Init
  267.  
  268. SurfaceLoop:
  269.     move    (a0)+,d6        ;d6 = number of points this surface
  270.     move    (a0)+,colour-labels(a4)
  271.  
  272.     bsr    CheckFace        ;check the visibility of the surface
  273.     cmp.l    d0,d1            ;can we see it?
  274.     bge.s    face_ok            ;yes.
  275.  
  276.     add    d6,d6
  277.     add    d6,a0        
  278.     bra    dont_do_it
  279.  
  280. face_ok:
  281.     subq    #2,d6
  282.         
  283. PointLoop:
  284.     move    (a0)+,d5        ;d5 = point number
  285.     subq    #1,d5
  286.     lsl    #2,d5
  287.  
  288.     move    d5,-(sp)        ;save for later...
  289.     move    (a1,d5),d0
  290.     move    2(a1,d5),d1        ;d0,d1 are first coord
  291. GetPoint:        
  292.     move    (a0)+,d5
  293.     subq    #1,d5
  294.     lsl    #2,d5
  295.     move    (a1,d5),d2
  296.     move    2(a1,d5),d3        ;d2,d3 are second coord
  297.     bsr    DrawLine        ;draw the line
  298.  
  299.     cmp    #3,colour-labels(a4)
  300.     bne.s    no_colour_3
  301.     move    #2,colour-labels(a4)
  302.     bsr    DrawLine
  303.     move    #3,colour-labels(a4)
  304. no_colour_3:
  305.     move    d2,d0
  306.     move    d3,d1
  307.     dbra    d6,GetPoint
  308.  
  309.     move    (sp)+,d5        ;the first point
  310.     move    (a1,d5),d2
  311.     move    2(a1,d5),d3        ;d2,d3 are second coord
  312. do_line2:
  313.     bsr    DrawLine        ;draw the line
  314.     cmp    #3,colour-labels(a4)
  315.     bne.s    dont_do_it
  316.     move    #2,colour-labels(a4)
  317.     bra.s    do_line2
  318.  
  319. dont_do_it:
  320.     dbra    d7,SurfaceLoop
  321.  
  322. ;*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*
  323. FillSurface:
  324.     move.l    ActiveBmap-labels(a4),a2
  325.     add.l    #(24000-2-6),a2
  326.     move.l    #$000c000c,d1
  327.     move    #(600*64)+14,d4
  328.  
  329.     Blitter_Wait
  330.         
  331.     move.l    #$09f00012,$40(a5)    ;Miniterms
  332.     move.l    d1,$64(a5)        ;A/D Modulo
  333.     Blitter_A    a2
  334.     Blitter_D    a2
  335.     Blit_Size    d4
  336.     rts
  337.         
  338. ;*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*
  339. x1        EQUR    d0
  340. y1        EQUR    d1
  341. x2        EQUR    d2
  342. y2        EQUR    d3
  343. x3        EQUR    d4
  344. y3        EQUR    d5
  345. dx1        EQUR    d1
  346. dy1        EQUR    d7
  347. dx2        EQUR    d0
  348. dy2        EQUR    d6
  349.  
  350. CheckFace:
  351.     movem.l    d6-d7/a0,-(sp)
  352.     move    (a0)+,d5        ;d5 = point number
  353.     subq    #1,d5
  354.     lsl    #2,d5
  355.     move    (a1,d5),x1
  356.     move    2(a1,d5),y1        ;d0,d1 are first coord
  357.  
  358.     move    (a0)+,d5
  359.     subq    #1,d5
  360.     lsl    #2,d5
  361.     move    (a1,d5),x2
  362.     move    2(a1,d5),y2        ;d2,d3 are second coord
  363.  
  364.     move    (a0)+,d5
  365.     subq    #1,d5
  366.     lsl    #2,d5
  367.     move    (a1,d5),x3
  368.     move    2(a1,d5),y3        ;d4,d5 are third coord
  369.  
  370.     move    y1,dy1
  371.     sub    y2,dy1            ;find delta y for first line
  372.     move    y2,dy2
  373.     sub    y3,dy2            ;find delta y for second line
  374.     move    x1,dx1
  375.     sub    x2,dx1            ;find delta x for first line
  376.     move    x2,dx2
  377.     sub    x3,dx2            ;find delta x for second line
  378.  
  379.     muls    dy1,dx2            ;here I just "cross multiply"
  380.     muls    dy2,dx1            ;the two slopes
  381.     movem.l    (sp)+,d6-d7/a0
  382.     rts
  383.  
  384. *******************************************************************************
  385. *            'DrawLine V1.01' By TIP/SPREADPOINT              *
  386. *******************************************************************************
  387.  
  388. DL_Width    =    40
  389. DL_Fill        =    1        ;0=NOFILL / 1=FILL
  390.     IFEQ    DL_Fill
  391. DL_MInterns    =    $CA
  392.     ELSE
  393. DL_MInterns    =    $4A
  394.     ENDC
  395.  
  396. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  397. ;    A0 = PlanePtr, A6 = $DFF002, D0/D1 = X0/Y0, D2/D3 = X1/Y1
  398. ;    D4 = PlaneWidth > Kills: D0-D4/A0-A1 (+D5 in Fill Mode)
  399.  
  400. DrawLine:
  401.     movem.l    d0-d5/a0-a1,-(sp)
  402.     move.l    ActiveBmap-labels(a4),a0
  403.     cmp    #2,colour-labels(a4)    ;if it's colour 2 we don't draw in
  404.     bne.s    no_plane_2
  405.     add.l    #8000,a0        ;   bpl one or three.
  406. no_plane_2:        
  407.     cmp    #4,colour-labels(a4)    ;if it's colour 4 we don't draw in
  408.     bne.s    no_plane_3
  409.     adda.l    #16000,a0        ;   bpl one or two.
  410. no_plane_3:
  411.     cmp    d1,d3            ;Drawing only from Top to Bottom is
  412.     bge.s    .y1ly2            ;necessary for:
  413.     exg    d0,d2            ; 1) Up-down Differences (same coords)
  414.     exg    d1,d3            ; 2) Blitter Invert Bit (only at top of
  415.                     ;    line)
  416. .y1ly2:
  417.     sub    d1,d3            ;D3 = yd
  418.  
  419. ; Here we could do an Optimization with Special Shifts
  420. ; depending on the DL_Width value... I know it, but please, let it be.
  421.  
  422.     mulu    #40,d1            ;Use muls for neg Y-Vals
  423.  
  424.     add.l    d1,a0            ;Please don't use add.w here !!!
  425.     moveq    #0,d1            ;D1 = Quant-Counter
  426.     sub    d0,d2            ;D2 = xd
  427.     bge.s    .xdpos
  428.     addq    #2,d1            ;Set Bit 1 of Quant-Counter (here it
  429.                     ;could be a moveq)
  430.     neg.w    d2
  431. .xdpos:
  432.     moveq    #$f,d4            ;D4 full cleaned (for later oktants
  433.                     ;move.b)
  434.     and    d0,d4
  435.     IFNE    DL_Fill
  436.         move.b    d4,d5        ;D5 = Special Fill Bit
  437.         not.b    d5
  438.     ENDC
  439.     lsr    #3,d0            ;Yeah, on byte (necessary for bchg)...
  440.     add    d0,a0            ;...Blitter ands automagically
  441.     ror    #4,d4            ;D4 = Shift
  442.     or    #$B00+DL_MInterns,d4    ;BLTCON0-codes
  443.     swap    d4
  444.     cmp    d2,d3            ;Which Delta is the Biggest ?
  445.     bge.s    .dygdx
  446.     addq    #1,d1            ;Set Bit 0 of Quant-Counter
  447.     exg    d2,d3            ;Exchange xd with yd
  448. .dygdx:
  449.     add    d2,d2            ;D2 = xd*2
  450.     move    d2,d0            ;D0 = Save for $52(a6)
  451.     sub    d3,d0            ;D0 = xd*2-yd
  452.     addx    d1,d1            ;Bit0 = Sign-Bit
  453.     move.b    Oktants(pc,d1),d4    ;In Low Byte of d4
  454.                     ;(upper byte cleaned above)
  455.     swap    d2
  456.     move    d0,d2
  457.     sub    d3,d2            ;D2 = 2*(xd-yd)
  458.     moveq    #6,d1            ;D1 = ShiftVal (not necessary) 
  459.                     ;+ TestVal for the Blitter
  460.     lsl    d1,d3            ;D3 = BLTSIZE
  461.     add    #$42,d3
  462.     lea    $52(a5),a1        ;A1 = CUSTOM+$52
  463. rept:
  464.     Blitter_Wait
  465.  
  466.     IFNE    DL_Fill
  467.         bchg    d5,(a0)        ;Inverting the First Bit of Line
  468.     ENDC
  469.     move.l    d4,$40(a5)        ;Writing to the Blitter Regs as fast
  470.     move.l    d2,$62(a5)        ;as possible
  471.     move.l    a0,$48(a5)
  472.     move.w    d0,(a1)+
  473.     move.l    a0,(a1)+        ;Shit-Word Buffer Ptr...
  474.     move.w    d3,(a1)
  475.     movem.l    (sp)+,d0-d5/a0-a1
  476.     rts
  477. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  478.     IFNE    DL_Fill
  479. SML        =     2
  480.     ELSE
  481. SML        =    0
  482.     ENDC
  483.  
  484. Oktants:
  485.     dc.b    SML+1,SML+1+$40
  486.     dc.b    SML+17,SML+17+$40
  487.     dc.b    SML+9,SML+9+$40
  488.     dc.b    SML+21,SML+21+$40
  489. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  490. ;        Optimized Init Part... A5 = $DFF000 > Kills : D0-D2
  491.  
  492. DL_Init:
  493.     movem.l    d0-d2,-(sp)
  494.     moveq    #-1,d1
  495.     IFGT    DL_Width-127
  496.         move    #DL_Width,d0
  497.     ELSE
  498.         moveq    #DL_Width,d0
  499.     ENDC
  500.         moveq    #6,d2
  501.     Blitter_Wait
  502.     move    d1,$44(a5)
  503.     move    d1,$72(a5)
  504.     move    #$8000,$74(a5)
  505.     move    d0,$60(a5)
  506.     move    d0,$66(a5)
  507.     movem.l    (sp)+,d0-d2
  508.     rts
  509.  
  510. ;*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*
  511. ;*+*+*+*+*+*+*+*+*+*+*+- Labels -+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+
  512. Labels:
  513. SineData:
  514.     dc.l $00000004,$0008000D,$00110016,$001A001F,$00230028,$002C0030,$00350039
  515.     dc.l $003D0042,$0046004A,$004F0053,$0057005B,$005F0064,$0068006C,$00700074
  516.     dc.l $0078007C,$00800083,$0087008B,$008F0092,$0096009A,$009D00A1,$00A400A7
  517.     dc.l $00AB00AE,$00B100B5,$00B800BB,$00BE00C1,$00C400C6,$00C900CC,$00CF00D1
  518.     dc.l $00D400D6,$00D900DB,$00DD00DF,$00E200E4,$00E600E8,$00E900EB,$00ED00EE
  519.     dc.l $00F000F2,$00F300F4,$00F600F7,$00F800F9,$00FA00FB,$00FC00FC,$00FD00FE
  520.     dc.l $00FE00FF,$00FF00FF,$00FF00FF
  521. CosineData:
  522.     dc.l $010000FF,$00FF00FF,$00FF00FF,$00FE00FE,$00FD00FC,$00FC00FB,$00FA00F9
  523.     dc.l $00F800F7,$00F600F4,$00F300F2,$00F000EE,$00ED00EB,$00E900E8,$00E600E4
  524.     dc.l $00E200DF,$00DD00DB,$00D900D6,$00D400D1,$00CF00CC,$00C900C6,$00C400C1
  525.     dc.l $00BE00BB,$00B800B5,$00B100AE,$00AB00A7,$00A400A1,$009D009A,$00960092
  526.     dc.l $008F008B,$00870083,$007F007C,$00780074,$0070006C,$00680064,$005F005B
  527.     dc.l $00570053,$004F004A,$00460042,$003D0039,$00350030,$002C0028,$0023001F
  528.     dc.l $001A0016,$0011000D,$00080004,$FFFFFFFB,$FFF7FFF2,$FFEEFFE9,$FFE5FFE0
  529.     dc.l $FFDCFFD7,$FFD3FFCF,$FFCAFFC6,$FFC2FFBD,$FFB9FFB5,$FFB0FFAC,$FFA8FFA4
  530.     dc.l $FFA0FF9B,$FF97FF93,$FF8FFF8B,$FF87FF83,$FF7FFF7C,$FF78FF74,$FF70FF6D
  531.     dc.l $FF69FF65,$FF62FF5E,$FF5BFF58,$FF54FF51,$FF4EFF4A,$FF47FF44,$FF41FF3E
  532.     dc.l $FF3BFF39,$FF36FF33,$FF30FF2E,$FF2BFF29,$FF26FF24,$FF22FF20,$FF1DFF1B
  533.     dc.l $FF19FF17,$FF16FF14,$FF12FF11,$FF0FFF0D,$FF0CFF0B,$FF09FF08,$FF07FF06
  534.     dc.l $FF05FF04,$FF03FF03,$FF02FF01,$FF01FF00,$FF00FF00,$FF00FF00,$FF00FF00
  535.     dc.l $FF00FF00,$FF00FF00,$FF01FF01,$FF02FF03,$FF03FF04,$FF05FF06,$FF07FF08
  536.     dc.l $FF09FF0B,$FF0CFF0D,$FF0FFF11,$FF12FF14,$FF16FF17,$FF19FF1B,$FF1DFF20
  537.     dc.l $FF22FF24,$FF26FF29,$FF2BFF2E,$FF30FF33,$FF36FF39,$FF3BFF3E,$FF41FF44
  538.     dc.l $FF47FF4A,$FF4EFF51,$FF54FF58,$FF5BFF5E,$FF62FF65,$FF69FF6D,$FF70FF74
  539.     dc.l $FF78FF7C,$FF80FF83,$FF87FF8B,$FF8FFF93,$FF97FF9B,$FFA0FFA4,$FFA8FFAC
  540.     dc.l $FFB0FFB5,$FFB9FFBD,$FFC2FFC6,$FFCAFFCF,$FFD3FFD7,$FFDCFFE0,$FFE5FFE9
  541.     dc.l $FFEEFFF2,$FFF7FFFB,$00000004,$0008000D,$00110016,$001A001F,$00230028
  542.     dc.l $002C0030,$00350039,$003D0042,$0046004A,$004F0053,$0057005B,$005F0064
  543.     dc.l $0068006C,$00700074,$0078007C,$00800083,$0087008B,$008F0092,$0096009A
  544.     dc.l $009D00A1,$00A400A7,$00AB00AE,$00B100B5,$00B800BB,$00BE00C1,$00C400C6
  545.     dc.l $00C900CC,$00CF00D1,$00D400D6,$00D900DB,$00DD00DF,$00E200E4,$00E600E8
  546.     dc.l $00E900EB,$00ED00EE,$00F000F2,$00F300F4,$00F600F7,$00F800F9,$00FA00FB
  547.     dc.l $00FC00FC,$00FD00FE,$00FE00FF,$00FF00FF,$00FF00FF
  548.  
  549. ActiveBmap    dc.l    Bmap2
  550. VisualBmap     dc.l    Bmap1
  551. CurrentObject    dc.l    Cube
  552. FaceList    ds.l    20
  553.  
  554. Cube:
  555.     dc.w    8            ; number of unique points
  556.     dc.w    0100,0100,0100
  557.     dc.w    0100,-100,0100
  558.     dc.w    -100,-100,0100
  559.     dc.w    -100,0100,0100
  560.     dc.w    0100,0100,-100
  561.     dc.w    0100,-100,-100
  562.     dc.w    -100,-100,-100
  563.     dc.w    -100,0100,-100
  564.     dc.w    5            ; number of surfaces - 1
  565.     dc.w    4,1            ; number of pts in surface 1
  566.     dc.w    4,1,2,3            ; pt numbers
  567.     dc.w    4,1
  568.     dc.w    5,8,7,6
  569.     dc.w    4,2
  570.     dc.w    5,6,2,1
  571.     dc.w    4,3
  572.     dc.w    4,8,5,1
  573.     dc.w    4,2
  574.     dc.w    4,3,7,8
  575.     dc.w    4,3
  576.     dc.w    2,6,7,3
  577.  
  578. colour        ds.w    1
  579. num_faces    ds.w    1
  580. SinX        ds.w    1
  581. CosX        ds.w    1
  582. SinY        ds.w    1
  583. CosY        ds.w    1
  584. SinZ        ds.w    1
  585. CosZ        ds.w    1
  586. XAngle        ds.w    1
  587. YAngle        ds.w    1
  588. ZAngle        ds.w    1
  589. Scale        ds.w    1
  590. XInc        ds.w    1
  591. YInc        ds.w    1
  592. ZInc        ds.w    1
  593. OutputCoords    ds.w    1
  594.         ds.w    2*42
  595.  
  596. ;*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*
  597. ;*+*+*+*+*+*+*+*+*+*+*+- Chip-Ram Stuff -+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+
  598.  
  599.     section    ChipRam,Code_c        ;All copperlists/bitplanes/sound/
  600.                     ;sprites/bobs etc. MUST be in
  601.                     ;ChipRam !
  602.  
  603. ;*+*+*+*+*+*+*+*+*+*+*+- Copper Lists -+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+
  604.  
  605. Copperlist:
  606.     dc.l $01003200            ;Only 3 bitplanes
  607.     dc.l $01020000
  608.     dc.l $01040000
  609.     dc.l $01080000,$010a0000    ;Modulos
  610.  
  611.     dc.l $00920038,$009400d0
  612.     dc.l $008e2cc1,$0090f4c1
  613.  
  614.     dc.w $0180,$0000        ;Colours
  615.     dc.w $0182,$0779
  616.     dc.w $0184,$088a
  617.     dc.w $0186,$099b
  618.     dc.w $0188,$0aac
  619.  
  620. BmapPtrs
  621.     dc.l $00e00000
  622.     dc.l $00e20000
  623.     dc.l $00e40000
  624.     dc.l $00e60000
  625.     dc.l $00e80000
  626.     dc.l $00ea0000
  627.  
  628.     dc.l $fffffffe
  629.     dc.l $fffffffe
  630.  
  631. ;*+*+*+*+*+*+*+*+*+*+*+- Buffers -+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*
  632.  
  633. Bmap1:        ds.b    24000
  634. Bmap2:        ds.b    24000
  635.